import Vue from "vue";
import VueRouter from "vue-router";
//import Login from '@/views/Login.vue'
import Home from '@/views/Main.vue'
import ShouYe from '@/views/ShouYe.vue'
import Dish from '@/views/Dish.vue'
import Table from '@/views/Table.vue'
import JinChu from '@/views/JinChu.vue'
import School from '@/views/School.vue'
import Grade from '@/views/Grade.vue'
import Student from '@/views/Student.vue'
import CheckTime from '@/views/CheckTime.vue'
import Check from '@/views/Check.vue'
import Leave from '@/views/Leave.vue'
import JieSong from '@/views/JieSong.vue'
import Teacher from '@/views/Teacher.vue'
import DishType from '@/views/DishType.vue'
import Order from '@/views/Order.vue'
import OrderDetails from '@/views/OrderDetails.vue'
//import Home from "../views/Home.vue";

Vue.use(VueRouter);

const routes = [
  { path: "/", redirect: '/login' },
  {
    path: '/home', name: 'home', component: Home, redirect: '/shouYe', meta: { title: '总览' },
    children: [
      { path: '/shouYe', name: 'ShouYe', component: ShouYe, meta: { title: '控制台' } },
      { path: '/dish', name: 'Dish', component: Dish, meta: { title: '菜品管理' } },
      { path: '/table', name: 'Table', component: Table, meta: { title: '餐台管理' } },
      { path: '/order', name: 'Order', component: Order, meta: { title: '订单管理' } },
      { path: '/orderdetails', name: 'OrderDetails', component: OrderDetails, meta: { title: '订单详情' } },
      { path: '/jinchu', name: 'JinChu', component: JinChu, meta: { title: '进出记录' } },
      { path: '/jiesong', name: 'JieSong', component: JieSong, meta: { title: '接送记录' } },
      { path: '/leave', name: 'Leave', component: Leave, meta: { title: '请假管理' } },
      { path: '/school', name: 'School', component: School, meta: { title: '学校管理' } },
      { path: '/grade', name: 'Grade', component: Grade, meta: { title: '年级管理' } },
      { path: '/student', name: 'Student', component: Student, meta: { title: '班级管理' } },
      { path: '/checktime', name: 'CheckTime', component: CheckTime, meta: { title: '考勤规则' } },
      { path: '/check', name: 'Check', component: Check, meta: { title: '考勤记录' } },
      { path: '/teacher', name: 'Teacher', component: Teacher, meta: { title: '教师管理' } },
      { path: '/dishType', name: 'DishType', component: DishType, meta: { title: '监护人管理' } },
    ]
  },
  {
    path: "/about",
    name: "About",
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () =>
      import(/* webpackChunkName: "about" */ "../views/About.vue"),
  },
  {
    path: "/login",
    name: "Login",
    component: () =>
      import("../views/Login.vue"),
  },
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
